﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;

namespace InTREPWP.Views
{
    public partial class ConfigurarLogin : BasePage
    {
        public ConfigurarLogin()
        {
            InitializeComponent();

            txtURL.Text = Settings.ServiceURL.Value;
            txtIMEI.Text = Settings.IMEI.Value;
        }

        private void btnSalvar_Click(object sender, RoutedEventArgs e)
        {
            try
            {                
                Settings.ServiceURL.Value = txtURL.Text;
                Settings.IMEI.Value = txtIMEI.Text;

                if (MessageBox.Show("Configurações salvas com sucesso!", "Sucesso", MessageBoxButton.OK) == MessageBoxResult.OK)
                    NavigationService.GoBack();
            }
            catch (Exception)
            {
                MessageBox.Show("Ocorreu um erro ao tentar salvar as configurações!","Erro", MessageBoxButton.OK);
            }

        }
    }
}